package com.lb.shopguide.adapter.viewpager;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lb.shopguide.entity.goods.GoodsTypeBean;
import com.lb.shopguide.ui.fragment.guide.goods.FragmentGoodsList;

import java.util.List;

/**
 * Created by kang on 2017/6/3.
 */

public class AdapterGoodsType extends FragmentPagerAdapter {

    private List<GoodsTypeBean> listTypes;

    private int goodsSelectType;

    public AdapterGoodsType(FragmentManager fm, List<GoodsTypeBean> list, int goodsSelectType) {
        super(fm);
        this.listTypes = list;
        this.goodsSelectType = goodsSelectType;
    }

    @Override
    public Fragment getItem(int position) {
        return FragmentGoodsList.newInstance(listTypes.get(position), goodsSelectType);
    }

    @Override
    public int getCount() {
        return listTypes.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return listTypes.get(position).getTypeName();
    }
}
